
package projetocompiladores;

import analisadorsintatico.GraphNode.Tipo;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import java.util.ArrayList;
import org.jhotdraw.draw.Figure;

/**
 *
 * @author Anderson
 */
public class GraphFigureNode {

    private String command;
    private Tipo tipo;
    private Point2D.Double position;
    private ArrayList<Point2D.Double> linkTo;

    public GraphFigureNode() {
        command = "";
        tipo = null;
        position = null;
        linkTo = new ArrayList<Point2D.Double>();
    }

    public GraphFigureNode(String command, Tipo tipo, Point2D.Double position) {
        this.command = command;
        this.tipo = tipo;
        this.position = position;
        linkTo = new ArrayList<Point2D.Double>();
    }

    public void addLink(Point2D.Double position) {
        linkTo.add(position);
    }

    public void setPosition(Point2D.Double position) {
        this.position = position;
    }

    public Double getPosition() {
        return position;
    }

    public String getCommand() {
        return command;
    }

    public void setCommand(String command) {
        this.command = command;
    }

    public ArrayList<Double> getLinkTo() {
        return linkTo;
    }

    public void setLinkTo(ArrayList<Double> linkTo) {
        this.linkTo = linkTo;
    }

    public Tipo getTipo() {
        return tipo;
    }

    public void setTipo(Tipo tipo) {
        this.tipo = tipo;
    }

    public void display() {
        System.out.print('{');
        System.out.print(command);
        System.out.print(", ");
        System.out.print(tipo);
        System.out.print(", ");
        System.out.print(position);
        System.out.print(", ");
        System.out.print(linkTo.toString());
        System.out.println("}");
    }

    @Override
    public String toString() {
        String node = "";
        node += '{' + command + ", " + tipo + "}";
        return node;
    }
}
